package com.mpj.servlet;

import com.mpj.util.HttpClientUtil;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Locale;

/**
 * Created by Administrator on 2016/6/24 0024.
 */
public class LanguageServlet extends HttpServlet {

    /**
     * Constructor of the object.
     */
    public LanguageServlet() {
        super();
    }

    /**
     * Destruction of the servlet. <br>
     */
    public void destroy() {
        HttpClientUtil.doGet("http://203.189.170.39/wd2/jsp/sys/Sf_render.jsp?hf_s_id=WD11&hf_srv_id=Zv_jcus_logout", null, "utf-8");
    }

    /**
     * The doGet method of the servlet. <br>
     *
     * This method is called when a form has its tag value method equals to get.
     *
     * @param request the request send by the client to the server
     * @param response the response send by the server to the client
     * @throws ServletException if an error occurred
     * @throws IOException if an error occurred
     */
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
//        CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();

        String language = request.getParameter("language");
        request.getSession().setAttribute("language", language);

    }

    /**
     * The doPost method of the servlet. <br>
     *
     * This method is called when a form has its tag value method equals to post.
     *
     * @param request the request send by the client to the server
     * @param response the response send by the server to the client
     * @throws ServletException if an error occurred
     * @throws IOException if an error occurred
     */
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

    }

    /**
     * Initialization of the servlet. <br>
     *
     * @throws ServletException if an error occurs
     */
    public void init() throws ServletException {
        HttpClientUtil.setting(true);
    }

}